/*
 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION!

import { int32, float32 } from "@koalaui/common"
import { nullptr, KPointer, KInt, KBoolean, KStringPtr } from "@koalaui/interop"
import { isResource, isInstanceOf, runtimeType, RuntimeType } from "@koalaui/interop"
import { Serializer } from "./Serializer"
import { ComponentBase } from "../ComponentBase"
import { PeerNode } from "../PeerNode"
import { ArkUIGeneratedNativeModule } from "#components"
import { ArkCommonMethodPeer, ArkCommonMethodAttributes } from "./ArkCommonPeer"
import { CommonMethod } from "./../ArkCommonInterfaces"
import { Component3DAttribute, SceneOptions } from "./../ArkComponent3dInterfaces"
import { ResourceStr, Dimension, PX, VP, FP, LPX, Percentage } from "./../ArkUnitsInterfaces"
import { Resource } from "./../ArkResourceInterfaces"
import { CallbackKind } from "./CallbackKind"
import { CallbackTransformer } from "./CallbackTransformer"
import { TypeChecker } from "#components"
import { wrapCallback } from "@koalaui/interop"
import { MaterializedBase } from "./../MaterializedBase"
import { DotIndicator } from "./../ArkDotIndicatorBuilder"
import { DigitIndicator } from "./../ArkDigitIndicatorBuilder"
import { SubTabBarStyle } from "./../ArkSubTabBarStyleBuilder"
import { BottomTabBarStyle } from "./../ArkBottomTabBarStyleBuilder"
export class ArkComponent3DPeer extends ArkCommonMethodPeer {
    protected constructor(peerPtr: KPointer, id: int32, name: string = "", flags: int32 = 0) {
        super(peerPtr, id, name, flags)
    }
    public static create(component?: ComponentBase, flags: int32 = 0): ArkComponent3DPeer {
        const peerId  = PeerNode.nextId()
        const _peerPtr  = ArkUIGeneratedNativeModule._Component3D_construct(peerId, flags)
        const _peer  = new ArkComponent3DPeer(_peerPtr, peerId, "Component3D", flags)
        component?.setPeer(_peer)
        return _peer
    }
    setComponent3DOptionsAttribute(sceneOptions?: SceneOptions): void {
        const thisSerializer : Serializer = Serializer.hold()
        let sceneOptions_type : int32 = RuntimeType.UNDEFINED
        sceneOptions_type = runtimeType(sceneOptions)
        thisSerializer.writeInt8(sceneOptions_type as int32)
        if ((RuntimeType.UNDEFINED) != (sceneOptions_type)) {
            const sceneOptions_value  = sceneOptions!
            thisSerializer.writeSceneOptions(sceneOptions_value)
        }
        ArkUIGeneratedNativeModule._Component3DInterface_setComponent3DOptions(this.peer.ptr, thisSerializer.asArray(), thisSerializer.length())
        thisSerializer.release()
    }
    environmentAttribute(value: ResourceStr): void {
        const thisSerializer : Serializer = Serializer.hold()
        let value_type : int32 = RuntimeType.UNDEFINED
        value_type = runtimeType(value)
        if (((RuntimeType.STRING == value_type))) {
            thisSerializer.writeInt8(0 as int32)
            const value_0  = value as string
            thisSerializer.writeString(value_0)
        }
        else if (((RuntimeType.OBJECT == value_type))) {
            thisSerializer.writeInt8(1 as int32)
            const value_1  = value as Resource
            thisSerializer.writeResource(value_1)
        }
        ArkUIGeneratedNativeModule._Component3DAttribute_environment(this.peer.ptr, thisSerializer.asArray(), thisSerializer.length())
        thisSerializer.release()
    }
    shaderAttribute(value: ResourceStr): void {
        const thisSerializer : Serializer = Serializer.hold()
        let value_type : int32 = RuntimeType.UNDEFINED
        value_type = runtimeType(value)
        if (((RuntimeType.STRING == value_type))) {
            thisSerializer.writeInt8(0 as int32)
            const value_0  = value as string
            thisSerializer.writeString(value_0)
        }
        else if (((RuntimeType.OBJECT == value_type))) {
            thisSerializer.writeInt8(1 as int32)
            const value_1  = value as Resource
            thisSerializer.writeResource(value_1)
        }
        ArkUIGeneratedNativeModule._Component3DAttribute_shader(this.peer.ptr, thisSerializer.asArray(), thisSerializer.length())
        thisSerializer.release()
    }
    shaderImageTextureAttribute(value: ResourceStr): void {
        const thisSerializer : Serializer = Serializer.hold()
        let value_type : int32 = RuntimeType.UNDEFINED
        value_type = runtimeType(value)
        if (((RuntimeType.STRING == value_type))) {
            thisSerializer.writeInt8(0 as int32)
            const value_0  = value as string
            thisSerializer.writeString(value_0)
        }
        else if (((RuntimeType.OBJECT == value_type))) {
            thisSerializer.writeInt8(1 as int32)
            const value_1  = value as Resource
            thisSerializer.writeResource(value_1)
        }
        ArkUIGeneratedNativeModule._Component3DAttribute_shaderImageTexture(this.peer.ptr, thisSerializer.asArray(), thisSerializer.length())
        thisSerializer.release()
    }
    shaderInputBufferAttribute(value: Array<number>): void {
        const thisSerializer : Serializer = Serializer.hold()
        thisSerializer.writeInt32(value.length as int32)
        for (let i = 0; i < value.length; i++) {
            const value_element : number = value[i]
            thisSerializer.writeNumber(value_element)
        }
        ArkUIGeneratedNativeModule._Component3DAttribute_shaderInputBuffer(this.peer.ptr, thisSerializer.asArray(), thisSerializer.length())
        thisSerializer.release()
    }
    renderWidthAttribute(value: Dimension): void {
        ArkUIGeneratedNativeModule._Component3DAttribute_renderWidth(this.peer.ptr, value)
    }
    renderHeightAttribute(value: Dimension): void {
        ArkUIGeneratedNativeModule._Component3DAttribute_renderHeight(this.peer.ptr, value)
    }
    customRenderAttribute(uri: ResourceStr, selfRenderUpdate: boolean): void {
        const thisSerializer : Serializer = Serializer.hold()
        let uri_type : int32 = RuntimeType.UNDEFINED
        uri_type = runtimeType(uri)
        if (((RuntimeType.STRING == uri_type))) {
            thisSerializer.writeInt8(0 as int32)
            const uri_0  = uri as string
            thisSerializer.writeString(uri_0)
        }
        else if (((RuntimeType.OBJECT == uri_type))) {
            thisSerializer.writeInt8(1 as int32)
            const uri_1  = uri as Resource
            thisSerializer.writeResource(uri_1)
        }
        ArkUIGeneratedNativeModule._Component3DAttribute_customRender(this.peer.ptr, thisSerializer.asArray(), thisSerializer.length(), selfRenderUpdate ? 1 : 0)
        thisSerializer.release()
    }
}
export interface ArkComponent3DAttributes extends ArkCommonMethodAttributes {
    environment?: ResourceStr
    shader?: ResourceStr
    shaderImageTexture?: ResourceStr
    shaderInputBuffer?: Array<number>
    renderWidth?: Dimension
    renderHeight?: Dimension
}
